<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 字符串的转换
        // 1. toString()可以将某些数据类型转为字符串
        var a = 1
        console.log(a, typeof a)
        var str = a.toString()
        console.log(str, typeof str)

        // 2.String(变量或字面量)可以将其他数据类型强转字符串
        var num1 = 1
        var str1 = String(num1)
        console.log(str1, typeof str1)

        // 3.字符串拼接
        var str2 = 1
        var str3 = ''
        console.log(str2 + str3,typeof (str2+str3))
    </script>
</body>

</html>